import sqlite3

conn = sqlite3.connect('database.db')

with open('db.sql') as f:
    conn.executescript(f.read())
# 创建一个执行句柄（勺子），用来执行后面的语句
cur = conn.cursor()

# 插入两条文章
cur.execute("insert into posts (title, content) values (?, ?)",
            ('study Flask1', 'follow the uncleMai to study Flask1')
            )

cur.execute("insert into posts (title, content) values (?, ?)",
            ('study Flask2', 'follow the uncleMai to study Flask2')
            )

conn.commit()
conn.close()
